package com.web.service.impl;

import com.web.dao.StudentDAO;
import com.web.dao.impl.StudentDAOImpl;
import com.web.entity.Student;
import com.web.service.StudentService;

import java.sql.SQLException;
import java.util.List;

public class StudentServiceImpl implements StudentService {
    private StudentDAO studentDAO = new StudentDAOImpl();
    @Override
    public List<Student> findAllStudents() {
        return studentDAO.selectAllStudents();
    }

    @Override
    public List<Student> findStudentsBykeyword(String keyword) {
        return studentDAO.selectStudentsBykeyword(keyword);
    }

    @Override
    public List<Student> findStudentsById(int id) {
        return studentDAO.selectStudentsById(id);
    }

    @Override
    public int addStudent(Student student) {
        return studentDAO.insertStudent(student);
    }

    @Override
    public int updateStudent(Student student) {
        return studentDAO.updateStudent( student);
    }

    @Override
    public int removeStudent(int id) {
        return studentDAO.deleteStudent(id);
    }


}


